﻿using Common.Attributes;
using Common.Enums;
using Domain.Entities.Identity;
using Domain.ValueObjects;
using System.ComponentModel;

namespace Application.Features.Menus.DTOs;

/// <summary>
/// 用户菜单
/// </summary>
[Map(typeof(Menu))]
public class UserMenuOutput
{
    /// <summary>
    /// 唯一标识
    /// </summary>
    [Description("唯一标识")]
    public long Id { get; set; }

    /// <summary>
    /// 唯一标识
    /// </summary>
    public long MenuId
    {
        get
        {
            return Id;
        }
    }

    /// <summary>
    /// 父级节点
    /// </summary>
    [Description("父级节点")]
    public long? ParentId { get; set; }

    /// <summary>
    /// 名称
    /// </summary>
    [Description("名称")]
    public string? Name { get; set; }

    /// <summary>
    /// 标识
    /// </summary>
    [Description("标识")]
    public string? Code { get; set; }

    /// <summary>
    /// 接口地址
    /// </summary>
    [Description("接口地址")]
    public string? Url { get; set; }

    /// <summary>
    /// 路径
    /// </summary>
    [Description("路径")]
    public string? Path { get; set; }

    /// <summary>
    /// 重定向
    /// </summary>
    [Description("重定向")]
    public string? Redirect { get; set; }

    /// <summary>
    /// 元信息
    /// </summary>
    [Description("元信息")]
    public UserMetaData? Meta { get; set; }

    /// <summary>
    /// 视图
    /// </summary>
    [Description("视图")]
    public string? Component { get; set; }

    /// <summary>
    /// 接口请求方式
    /// </summary>
    [Description("接口请求方式")]
    public virtual string? HttpMethods { get; set; }


}

[Map(typeof(Menu))]
public class UserMenuTreeOutput : UserMenuOutput
{
    [Map(typeof(List<Menu>))]
    public List<UserMenuOutput> Children { get; set; }
}

[Map(typeof(Meta))]
public class UserMetaData
{
    /// <summary>
    /// 菜单名称
    /// </summary>
    [Description("菜单名称")]
    public string? Title { get; set; }

    /// <summary>
    /// 图标
    /// </summary>
    [Description("图标")]
    public string? Icon { get; set; }

    /// <summary>
    /// 菜单高亮
    /// </summary>
    [Description("菜单高亮")]
    public string? Active { get; set; }

    /// <summary>
    /// 颜色
    /// </summary>
    [Description("颜色")]
    public string? Color { get; set; }

    /// <summary>
    /// 类型
    /// </summary>
    [Description("类型")]
    public MetaType? Type { get; set; }

    /// <summary>
    /// 整页路由
    /// </summary>
    [Description("整页路由")]
    public bool? Fullpage { get; set; }

    /// <summary>
    /// 隐藏
    /// </summary>
    [Description("隐藏")]
    public bool? Hidden { get; set; }

    /// <summary>
    /// 隐藏面包屑
    /// </summary>
    [Description("隐藏面包屑")]
    public bool? HiddenBreadcrumb { get; set; }

    /// <summary>
    /// 标签
    /// </summary>
    [Description("标签")]
    public string? Tag { get; set; }

    /// <summary>
    /// 权限值
    /// </summary>
    [Description("权限值")]
    public List<string?> Auths { get; set; } = new List<string?>();
}